import Cookies from "js-cookie"
// 依赖
import Vue from 'vue'
import VueRouter from 'vue-router'
// import store from '@/vuex/store.js'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
// import baseHttp from '@/assets/js/base_http.js'
// import Lockr from 'lockr'
// import config from '@/assets/js/config.js'
import _g from '@/assets/js/global.js'
// 组件
let Login = (resolve) => require(['@/components/Account/Login.vue'], resolve)

// 中转页
// let SupplierAllBack = (resolve) => require(['@/components/Admin/common/supplierAllBack.vue'], resolve)

// let Home = (resolve) => require(['@/components/Home.vue'], resolve)
let addResumeMsg = (resolve) => require(['@/components/addResumeMsg.vue'], resolve)

/* 管理员 */

let positionList = (resolve) => require(['@/components/Admin/structures/position/list.vue'], resolve)
let positionAdd = (resolve) => require(['@/components/Admin/structures/position/add.vue'], resolve)
let positionEdit = (resolve) => require(['@/components/Admin/structures/position/edit.vue'], resolve)
let structuresList = (resolve) => require(['@/components/Admin/structures/structures/list.vue'], resolve)

let structuresAddDepart = (resolve) => require(['@/components/Admin/structures/structures/addDepart.vue'], resolve)
// let structuresEdit = (resolve) => require(['@/components/Admin/structures/structures/edit.vue'], resolve)
let ViewStructure = (resolve) => require(['@/components/Admin/structures/structures/viewStructure.vue'], resolve)

// let resumeList = (resolve) => require(['@/components/Admin/structures/resume/add.vue'], resolve)
let resumeDetail = (resolve) => require(['@/components/Admin/structures/resume/detail.vue'], resolve)
let resumeDetailRead = (resolve) => require(['@/components/Admin/structures/resume/detailRead.vue'], resolve)

let usersList = (resolve) => require(['@/components/Admin/personnel/users/list.vue'], resolve)
let usersAdd = (resolve) => require(['@/components/Admin/personnel/users/add.vue'], resolve)
let usersMenu = (resolve) => require(['@/components/Admin/personnel/users/menu.vue'], resolve)
let myselfMenu = (resolve) => require(['@/components/Admin/personnel/users/myselfMenu.vue'], resolve)
let usersTax = (resolve) => require(['@/components/Admin/personnel/users/tax.vue'], resolve)
let Time = (resolve) => require(['@/components/Admin/personnel/users/time.vue'], resolve)
let personCenter = (resolve) => require(['@/components/Admin/personnel/users/personCenter.vue'], resolve)

let noticeAdd = (resolve) => require(['@/components/Admin/notice/noticeAdd.vue'], resolve)
let noticeEdit = (resolve) => require(['@/components/Admin/notice/noticeEdit.vue'], resolve)
let noticeList = (resolve) => require(['@/components/Admin/notice/noticeList.vue'], resolve)

let rankAdd = (resolve) => require(['@/components/Admin/rank/rankAdd.vue'], resolve)
let rankEdit = (resolve) => require(['@/components/Admin/rank/rankEdit.vue'], resolve)
let rankList = (resolve) => require(['@/components/Admin/rank/rankList.vue'], resolve)

let EditDepart = (resolve) => require(['@/components/Admin/structures/structures/editDepart.vue'], resolve)

let ContractTemplList = (resolve) => require(['@/components/Admin/contractTempl/contractTemplList.vue'], resolve)

// 工作任务管理
// 立项分析
let proAnalyList = (resolve) => require(['@/components/Admin/tasks/rdTask/proAnaly/list'], resolve)
let proAnalyGantt = (resolve) => require(['@/components/Admin/tasks/rdTask/proAnaly/proAnalyGantt'], resolve)

// 项目内测
let AdminProInnerList = (resolve) => require(['@/components/Admin/tasks/rdTask/proInner/list.vue'], resolve)

// 项目
let AdminProList = (resolve) => require(['@/components/Admin/tasks/rdTask/ProList/list.vue'], resolve)
let AdminProAdd = (resolve) => require(['@/components/Admin/tasks/rdTask/ProList/add.vue'], resolve)

// 工程任务
let AdminEngineerCheck = (resolve) => require(['@/components/Admin/tasks/engineerTask/check.vue'], resolve)
let AdminEngineerException = (resolve) => require(['@/components/Admin/tasks/engineerTask/exception.vue'], resolve)
let AdminEngineerJig = (resolve) => require(['@/components/Admin/tasks/engineerTask/jig.vue'], resolve)
let AdminEngineerTrialProduction = (resolve) => require(['@/components/Admin/tasks/engineerTask/trialProduction.vue'], resolve)

// 行政任务
let AdminAministrativeDesign = (resolve) => require(['@/components/Admin/tasks/administrativeTask/design.vue'], resolve)
let AdminAministrativeMakingTender = (resolve) => require(['@/components/Admin/tasks/administrativeTask/makingTender.vue'], resolve)
let AdminAministrativeRdAccident = (resolve) => require(['@/components/Admin/tasks/administrativeTask/rdAccident.vue'], resolve)
let AdminAministrativeSampleTest = (resolve) => require(['@/components/Admin/tasks/administrativeTask/sampleTest.vue'], resolve)

// BUG处理
let AdminBugList = (resolve) => require(['@/components/Admin/tasks/bug/list.vue'], resolve)


// let AdminWelcome = (resolve) => require(['@/components/Admin/welcome/adminWelcome.vue'], resolve)


/* 普通用户 */
let GuestHome = (resolve) => require(['@/components/guestHome.vue'], resolve)
let Welcome = (resolve) => require(['@/components/guest/welcome/welcome.vue'], resolve)
let GuestResumeReadOnly = (resolve) => require(['@/components/guest/resume/guestResumeReadOnly.vue'], resolve)
let Pay = (resolve) => require(['@/components/guest/resume/pay.vue'], resolve)
let NoticeList = (resolve) => require(['@/components/guest/notice/noticeList.vue'], resolve)

// 工作任务
let AdministrativeTask = (resolve) => require(['@/components/guest/task/administrativeTask.vue'], resolve)
let Bug = (resolve) => require(['@/components/guest/task/bug.vue'], resolve)
let EngineerTask = (resolve) => require(['@/components/guest/task/engineerTask.vue'], resolve)
let RdTask = (resolve) => require(['@/components/guest/task/rdTask.vue'], resolve)

/* 公共 */
let NoticeDetail = (resolve) => require(['@/components/comPage/noticeDetail.vue'], resolve)

/* 404页面 */
let NotFound = (resolve) => require(['@/components/Guest/other/notFound.vue'], resolve)

/* 物料管理 */
let MaterielList = (resolve) => require(['@/components/Materiel/materiel/list.vue'], resolve)
let ManagerWarehouse = (resolve) => require(['@/components/Materiel/warehouse/list.vue'], resolve)
let MaterielSupplier = (resolve) => require(['@/components/Materiel/supplier/list.vue'], resolve)
let MaterielSuppliers = (resolve) => require(['@/components/Materiel/supplier/supplier.vue'], resolve)
let browseMateriel = (resolve) => require(['@/components/Materiel/materiel/browse.vue'], resolve)
/*let MaterielAdd = (resolve) => require(['@/components/Materiel/materiel/add.vue'], resolve)*/

/* 权限管理 */
let permissionList = (resolve) => require(['@/components/permission/index.vue'], resolve)

/* 流程管理 */
let workflow = (resolve) => require(['@/components/server/workflow.vue'], resolve)
let myApply = (resolve) => require(['@/components/Materiel/materiel/myApply.vue'], resolve)
let myApplyDetail = (resolve) => require(['@/components/Materiel/materiel/myApplyDetail.vue'], resolve)

/* 天猫管理平台 */
let tmailpro = (resolve) => require(['@/components/tmail/page/tmailpro.vue'], resolve)
Vue.use(VueRouter)

/**
 * meta参数解析
 * hideLeft: 是否隐藏左侧菜单，单页菜单为true
 * module: 菜单所属模块
 * menu: 所属菜单，用于判断三级菜单是否显示高亮，如菜单列表、添加菜单、编辑菜单都是'menu'，用户列表、添加用户、编辑用户都是'user'，如此类推
 */

const routes = [{
    path: '/',
    component: Login,
    name: 'Login',
    meta: {
        requireAuth: false,  // 添加该字段，表示进入这个路由是否需要登录的，true需要登录，false不需要登录
        isResumePage: false,      //  默认不为填写履历页面
        isLoginPage: true,         //  默认为登录页面
        isShowCloseIcon: false
    }
}, {
    path: '/addResume',
    component: addResumeMsg,
    name: '初次填写履历信息',
    meta: {
        requireAuth: true,
        isResumePage: true,
        isLoginPage: false,         //  默认不为登录页面
        isShowCloseIcon: false
    }
},

// 普通用户页面
{
    path: '/guest',
    redirect: '/guest/welcome',
    // name: '个人中心',
    name: '',
    component: GuestHome,
    meta: {
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
        isShowCloseIcon: false
    },
    children: [{
        path: 'welcome',
        component: Welcome,
        name: '个人中心',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'guestResumeReadOnly',
        component: GuestResumeReadOnly,
        name: '履历表',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'pay',
        component: Pay,
        name: '薪酬',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'noticeList',
        component: NoticeList,
        name: '公告栏',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        },
    }, {
        path: 'noticeDetail',
        component: NoticeDetail,
        name: '公告正文',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    }]
},

// 工作任务
{
    path: '/guest',
    component: GuestHome,
    name: '工作任务',
    // meta: {
    //     topMenu: '工作任务',
    //     isShowCloseIcon: false,
    //     requireAuth: true,  
    //     isResumePage: false,
    //     isLoginPage: false,         //  默认不为登录页面
    // },
    children: [{
        path: 'rdTask/list',
        component: RdTask,
        name: '研发任务',
        meta: {
            menuLevel: '2',                                                  //..代表在下拉菜单中处于2级菜单
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'engineerTask/list',
        component: EngineerTask,
        name: '工程任务',
        meta: {
            menuLevel: '2',                                                  //..代表在下拉菜单中处于2级菜单
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'administrativeTask/list',
        component: AdministrativeTask,
        name: '行政任务',
        meta: {
            menuLevel: '2',                                                  //..代表在下拉菜单中处于2级菜单
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'bug/list',
        component: Bug,
        name: 'BUG',
        meta: {
            menuLevel: '2',                                                  //..代表在下拉菜单中处于2级菜单
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    },]
},
//前台物料
{
    path: '/guest',
    component: GuestHome,
    name: '物料',
    children: [
        {
            path: 'browse',
            component: browseMateriel,
            name: '申请和领用',
            meta: {
                menuLevel: '2',                                                  //..代表在下拉菜单中处于2级菜单
                requireAuth: true,
                isResumePage: false,
                isLoginPage: false,         //  默认不为登录页面
                isShowCloseIcon: false
            },
        },
        {
            path: 'materiel/myApply',
            component: myApply,
            name: '我的申请',
            meta: {
                menuLevel: '2',
                requireAuth: true,
                isResumePage: false,
                isLoginPage: false,         //  默认不为登录页面
                isShowCloseIcon: true
            },
        },
        {
            path: 'materiel/myApply/detail',
            component: myApplyDetail,
            name: '流程详细信息',
            meta: {
                topMenu: '我的申请',
                menuLevel: '2',
                requireAuth: true,
                isResumePage: false,
                isLoginPage: false,         //  默认不为登录页面
                isShowCloseIcon: true
            }
        }
    ],
},

/* ************************************************管理员页面******************************************************** */
/* 管理员欢迎页面 */
// {
//     path: '/admin',
//     meta: {
//         topMenu: '',
//         isShowCloseIcon : false,
//         requireAuth: true,  
//         isResumePage: false,
//         isLoginPage: false,         //  默认不为登录页面
//     },
//     component: Home,
//     children: [{
//         path: 'welcome',
//         component: AdminWelcome,
//         name: '管理员界面',
//         meta: {
//             requireAuth: true,  
//             isResumePage: false,
//             isLoginPage: false,         //  默认不为登录页面
//             isShowCloseIcon : false
//         }
//     }]
// },
//职位管理
{
    path: '/admin',
    redirect: '/guest/welcome',
    // meta: {
    //     requireAuth: true,  
    //     isResumePage: false,
    //     isLoginPage : false,         //  默认不为登录页面
    // },
    name: '职位管理',
    meta: {
        topMenu: '人力资源',
        isShowCloseIcon: false,
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
        isShowCloseIcon: true
    },
    // component: Home,
    component: GuestHome,
    children: [{
        path: 'position/list',
        component: positionList,
        name: '所有职位',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'position',
            menuLevel: '2',                                                  //..代表在下拉菜单中处于2级菜单
            // titles: ['人力资源', '职位管理'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    },
    {
        path: 'position/add',
        component: positionAdd,
        name: '新增职位',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'position',
            menuLevel: '3',
            // titles: ['人力资源', '职位管理', '新增职位'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'position/edit',
        component: positionEdit,
        name: '编辑职位',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'position',
            menuLevel: '3',
            // titles: ['人力资源', '职位管理', '修改职位'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    }
    ]
},

//   部门管理
//   组织架构管理
{
    path: '/admin',
    // component: Home,
    component: GuestHome,
    // name: '部门管理',
    name: '组织架构管理',
    meta: {
        topMenu: '人力资源',
        isShowCloseIcon: false,
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
        isShowCloseIcon: true
    },
    children: [{
        path: 'structures/list',
        component: structuresList,
        name: '所有组织架构',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'structures',
            menuLevel: '2',
            // titles: ['人力资源', '部门管理'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    },
    {
        path: 'structures/addDepart',
        component: structuresAddDepart,
        // name: '新增部门',
        name: '新增组织架构',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'structures',
            menuLevel: '3',
            // titles: ['人力资源', '部门管理', '新增部门'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'structures/editDepart',
        component: EditDepart,
        name: '编辑部门',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'structures',
            menuLevel: '3',
            // titles: ['人力资源', '部门管理', '编辑部门'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'structures/viewStructure',
        component: ViewStructure,
        name: '组织架构图',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'structures',
            menuLevel: '3',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    }
    ]
},

//   职级管理
{
    path: '/admin',
    // component: Home,
    component: GuestHome,
    name: '职级管理',
    meta: {
        topMenu: '人力资源',
        isShowCloseIcon: false,
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
        isShowCloseIcon: true
    },
    children: [{
        path: 'rank/list',
        component: rankList,
        name: '所有职级',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'rank',
            menuLevel: '2',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    },
    {
        path: 'rank/add',
        component: rankAdd,
        name: '新增职级',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'rank',
            menuLevel: '3',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'rank/edit',
        component: rankEdit,
        name: '编辑职级',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'rank',
            menuLevel: '3',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    }
    ]
},

//   合同模板
{
    path: '/admin',
    // component: Home,
    component: GuestHome,
    name: '合同模板',
    meta: {
        topMenu: '人力资源',
        isShowCloseIcon: false,
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
        isShowCloseIcon: true
    },
    children: [{
        path: 'contractTempl/list',
        component: ContractTemplList,
        name: '合同模板',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'contractTempl',
            menuLevel: '2',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }]
},

//   公告管理
{
    path: '/admin',
    // component: Home,
    component: GuestHome,
    name: '公告管理',
    meta: {
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
        isShowCloseIcon: false
    },
    children: [{
        path: 'notice/list',
        component: noticeList,
        name: '所有公告',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    },
    {
        path: 'notice/add',
        component: noticeAdd,
        name: '新增公告',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'notice/edit',
        component: noticeEdit,
        name: '编辑公告',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    }, {
        path: 'notice/noticeDetail',
        component: NoticeDetail,
        name: '公告正文',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    }
    ]
},

// 用户基本信息  
{
    path: '/admin',
    // component: Home,
    component: GuestHome,
    name: '用户基本信息',
    meta: {
        topMenu: '人力资源',
        isShowCloseIcon: false,
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
    },
    children: [{
        path: 'users/list',
        component: usersList,
        name: '所有用户',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '2',
            name: '所有用户',
            // titles: ['人力资源', '用户基本信息','所有用户'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    },
    {
        path: 'users/add',
        component: usersAdd,
        name: '编辑用户',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '3',
            // titles: ['人力资源', '用户基本信息','所有用户', '编辑用户'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'users/Menu/:userId/:staffNum/:userName',
        component: usersMenu,
        name: '用户权限',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'users/myselfMenu/:userId/:staffNum/:userName',
        component: myselfMenu,
        name: '我的权限',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'users/tax',
        component: usersTax,
        name: '六项申报扣除',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '3',
            // titles: ['人力资源', '用户基本信息','所有用户', '六项申报扣除'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'users/personCenter',
        component: personCenter,
        name: '个人中心',
        meta: {
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'users/resumeDetail',
        component: resumeDetail,
        name: '用户履历',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '3',
            // titles: ['人力资源', '用户基本信息','所有用户', '用户履历'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'users/resumeDetailRead',
        component: resumeDetailRead,
        name: '用户履历',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '3',
            // titles: ['人力资源', '用户基本信息','所有用户', '用户履历信息'],
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'users/time',
        component: Time,
        name: '时间配置',
        meta: {
            module: 'Admin',
            menu: 'time',
            menuLevel: '3',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    ]
},

// 工作任务管理  
{
    path: '/admin',
    component: GuestHome,
    name: '研发任务',
    meta: {
        topMenu: '工作任务管理',
        isShowCloseIcon: false,
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
    },
    children: [{
        path: 'pro/list',
        component: AdminProList,
        name: '项目列表',
        meta: {
            name: '项目列表',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'proAnaly/List',
        component: proAnalyList,
        name: '立项分析',
        meta: {
            name: '立项分析',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'proAnaly/proAnalyGantt',
        component: proAnalyGantt,
        name: '甘特图详情',
        meta: {
            topMenu: '立项分析',
            name: '甘特图',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'pro/add',
        component: AdminProAdd,
        name: '新建项目',
        meta: {
            name: '新建项目',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: true
        }
    },
    {
        path: 'proInner/list',
        component: AdminProInnerList,
        name: '项目内测',
        meta: {
            name: '项目内测',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    },
    ]
},
{
    path: '/admin',
    component: GuestHome,
    name: '工程任务',
    meta: {
        topMenu: '工作任务管理',
        isShowCloseIcon: false,
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
    },
    children: [{
        path: 'engineer/check',
        component: AdminEngineerCheck,
        name: '项目验收',
        meta: {
            name: '项目验收',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'engineer/trialProduction',
        component: AdminEngineerTrialProduction,
        name: '试生产',
        meta: {
            name: '试生产',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'engineer/exception',
        component: AdminEngineerException,
        name: '异常处理',
        meta: {
            name: '异常处理',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'engineer/jig',
        component: AdminEngineerJig,
        name: '治具',
        meta: {
            name: '治具',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }
    ]
},
{
    path: '/admin',
    component: GuestHome,
    name: '行政任务',
    meta: {
        topMenu: '工作任务管理',
        isShowCloseIcon: false,
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
    },
    children: [{
        path: 'adminAministrative/design',
        component: AdminAministrativeDesign,
        name: '设计任务',
        meta: {
            name: '设计任务',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'adminAministrative/sampleTest',
        component: AdminAministrativeSampleTest,
        name: '样品测试',
        meta: {
            name: '样品测试',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'adminAministrative/makingTender',
        component: AdminAministrativeMakingTender,
        name: '标书制作',
        meta: {
            name: '标书制作',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }, {
        path: 'adminAministrative/rdAccident',
        component: AdminAministrativeRdAccident,
        name: '研发事故',
        meta: {
            name: '研发事故',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }
    ]
},
//物料管理
{
    path: '/materiel',
    component: GuestHome,
    name: '物料管理',
    meta: {
        isShowCloseIcon: false,
        requireAuth: false,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
    },
    children: [{
        path: 'list',
        component: MaterielList,
        name: '管理员',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '2',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,
            isShowCloseIcon: false
        }
    }, {
        path: 'warehouse',
        component: ManagerWarehouse,
        name: '物料管理',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '2',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,
            isShowCloseIcon: false
        }
    }, {
        path: 'supplier',
        component: MaterielSupplier,
        name: '供应商管理',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '2',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,
            isShowCloseIcon: false
        }
    }, {
        path: 'suppliers',
        component: MaterielSuppliers,
        name: '供应商列表',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '2',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,
            isShowCloseIcon: true
        }
    }]
},
//权限管理
{
    path: '/admin',
    component: GuestHome,
    name: '权限管理',
    meta: {
        isShowCloseIcon: false,
        requireAuth: false,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
    },
    children: [{
        path: 'permission/index',
        component: permissionList,
        name: '权限列表',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '2',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,
            isShowCloseIcon: false
        }
    },]
},
//流程管理
{
    path: '/admin',
    component: GuestHome,
    name: '后台管理',
    meta: {
        isShowCloseIcon: false,
        requireAuth: false,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
    },
    children: [{
        path: 'workflow/index',
        component: workflow,
        name: '流程管理',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menu: 'users',
            menuLevel: '2',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,
            isShowCloseIcon: false
        }
    },]
},
//天猫管理
{
    path: '/tmail',
    // component: Home,
    component: GuestHome,
    name: '天猫管理',
    meta: {
        topMenu: '天猫后台',
        isShowCloseIcon: false,
        requireAuth: true,
        isResumePage: false,
        isLoginPage: false,         //  默认不为登录页面
        isShowCloseIcon: true
    },
    children: [{
        path: 'tmail/list',
        component: tmailpro,
        name: '天猫产品',
        meta: {
            hideLeft: false,
            module: 'Admin',
            menuLevel: '2',
            requireAuth: true,
            isResumePage: false,
            isLoginPage: false,         //  默认不为登录页面
            isShowCloseIcon: false
        }
    }]
},
//详情页
{ path: '*', component: NotFound }
    //   {
    //     path: '/admin',
    //     component: Home,
    //     isShowCloseIcon : false,
    //     children: [{
    //         path: 'resume/list',
    //         component: resumeList,
    //         name: 'usersList',
    //         meta: {
    //             hideLeft: false,
    //             module: 'Admin',
    //             menu: 'users',
    //             menuLevel:'2', 
    //             titles: ['人力资源', '用户履历管理'],
    //             requireAuth: true,  
    //             isResumePage: false,
    //             isLoginPage: false,         //  默认不为登录页面
    //             isShowCloseIcon : true
    //         }
    //       },
    //     ]
    //   },
]

const router = new VueRouter({
    //   mode: 'history',
    base: __dirname,
    routes
})

// router.beforeEach((to, from, next) => {
//     const token = Cookies.get('PHPSESSID')
//     const userPromise = Cookies.get('userPromise')                          //..是否承诺履历基本信息
//     // if (Cookies.get('isAdmin')) { 
//     //     store.dispatch('setIsAdmin',Cookies.get('isAdmin'))
//     // }

//     if (to.matched.some(record => record.meta.requireAuth)) {  // 判断该路由是否需要登录权限


//         if (token) {  // 判断当前的token是否存在
//             if (userPromise == 2) {                                              //  如果没有承诺
//                 if (from.meta.isLoginPage === false) {                                  //  如果不是来自登录页面
//                     // console.log(new Date())
//                     // console.log(to.matched.some(record => (record.meta.isResumePage === false)))
//                     // console.log(to.matched)
//                     // console.log(from.matched.every(record => (record.name === '初次填写履历信息')))
//                     // console.log(from.matched)
//                     if (to.matched.some(record => (record.meta.isResumePage === false))) {                                  //  如果不是去履历填写页面
//                         if (from.matched.every(record => (record.name === '初次填写履历信息'))) {                       //  如果已经在履历填写页面
//                             next(false)
//                         } else {
//                             NProgress.start()
//                             next({
//                                 path: '/addResume',                                             //..跳转到履历信息填写页面
//                             })
//                         }
//                     } else {
//                         NProgress.start()
//                         next();
//                     }
//                 } else {
//                     NProgress.start()
//                     next();
//                 }

//             } else {
//                 NProgress.start()
//                 next();
//             }
//         }
//         else {
//             NProgress.start()
//             next({
//                 path: '/',
//                 // query: {redirect: to.fullPath}  // 将跳转的路由path作为参数，登录成功后跳转到该路由
//             })
//         }
//     }
//     else {
//         next();
//     }
// });
// router.beforeEach(async (to, from, next) => {
//   // const hideLeft = to.meta.hideLeft
//   // store.dispatch('showLeftMenu', hideLeft)
//   // // 如果跳转去登录页
//   // if (to.name !== 'Login') {
//   //   const expire = Lockr.get('expire')
//   //   const advanceTime = config.advanceTime
//   //   const nowTime = Math.floor(new Date().getTime() / 1000)
//   //   const infos = baseHttp.apiPost('admin/infos/index')
//   //   const quees = [infos]
//   //   // if (nowTime >= (expire - advanceTime)) {
//   //   const refresh = baseHttp.apiPost('admin/infos/refresh') // 获取新token
//   //   quees.push(refresh)
//   //   // }
//   //   const result = await Promise.all(quees)
//   //   // 如果请求多于1个（获取用户信息）
//   //   if (result.length >= 1) {
//   //     if (result[0].code === 200) {
//   //       const data = result[0].data
//   //       store.dispatch('setMenus', data.menusList) // 菜单信息
//   //       store.dispatch('setRules', data.authList) // 权限信息
//   //       store.dispatch('setUsers', data.userInfo) // 用户信息
//   //     } else {
//   //       _g.toastMsg('warning', '请重新登录')
//   //       setTimeout(() => {
//   //         router.replace('/')
//   //       }, 1500)
//   //       return
//   //     }
//   //   };
//   //   // 如果请求多于2个(获取用户信息，刷新token)
//   //   if (result.length >= 2) {
//   //     if (result[0].code === 200) {
//   //       const data = result[1].data
//   //       Lockr.set('authKey', data.authKey) // 权限认证
//   //       Lockr.set('expire', data.expire) // 权限认证
//   //     } else {
//   //       _g.toastMsg('warning', '请重新登录')
//   //       setTimeout(() => {
//   //         router.replace('/')
//   //       }, 1500)
//   //       return
//   //     }
//   //   }
//   // }
//   NProgress.start()
//   next()
// })

router.afterEach(transition => {
    NProgress.done()
})

export default router
